package testing;

import gamemngr.GameMngr;
import junit.framework.TestCase;
import logic.Country;
import logic.Player;
import logic.RecordTable;
import logic.moves.SettleMove;


public class RecordTest extends TestCase{
	
	public void testRecord() {
		RecordTable tab = new RecordTable();
		GameMngr gm = new GameMngr();
		int i=1;
		for (i=0; i<RecordTable.numberOfRecords; i++) {
			Country Israel = new Country("Israel"+i);
			Player p = new Player("p"+i,new GameMngr());
			SettleMove set = new SettleMove(Israel,p);
			p.addMove(set, false);
			p.commitMoves();
			System.out.println(p.getNumberOfMoves());
			tab.addToRecordTable(p);
		}
		//System.out.println("\n" + tab);
		Player win = new Player("win",new GameMngr());
		Player lose = new Player("lose",new GameMngr());
		Country Israel = new Country("Israel9999");
		SettleMove set = new SettleMove(Israel,lose);
		lose.addMove(set, false);
		Country Israel1 = new Country("Israel99999");
		SettleMove set1 = new SettleMove(Israel1,lose);
		lose.addMove(set1, false);
		lose.commitMoves();
		tab.addToRecordTable(lose);
		tab.addToRecordTable(win);
		System.out.println("\n" + tab);
		assertEquals(tab.isHasRecord(win), true);
		assertEquals(tab.isHasRecord(lose), false);
	}

}
